#ifndef __EXCEPTIONS_H__
#define __EXCEPTIONS_H__

#include <exception>
#include <string>

typedef std::bad_alloc OutOfMemoryException;

struct Exception : std::exception {
    Exception();
    Exception(const char *what);
    Exception(const std::string &what);
    ~Exception() throw() { }

    const char* what() const throw();
private:
    std::string mWhat;
};

//-----------------------------------------------------------------------------
struct ArgumentException : Exception {
	ArgumentException();
	ArgumentException(const char *what);
    ArgumentException(const std::string &what);
	ArgumentException(const char *argName, const char *what);

	~ArgumentException() throw() { }
	
	const char* getArgumentName() const;
private:
	std::string mArgument;
};

//-----------------------------------------------------------------------------
struct ArgumentNullException : ArgumentException {
	ArgumentNullException();
	ArgumentNullException(const char* argName);
};

//-----------------------------------------------------------------------------
struct ArgumentOutOfRangeException : ArgumentException {
	ArgumentOutOfRangeException();
	ArgumentOutOfRangeException(const char* argName);
	ArgumentOutOfRangeException(const char* argName, const char* what);
};

//-----------------------------------------------------------------------------

struct InvalidOperationException : Exception {
	InvalidOperationException();
	InvalidOperationException(const char* what);
	~InvalidOperationException() throw () { }
};

//-----------------------------------------------------------------------------
struct NotImplementedException : Exception {
	NotImplementedException();
	NotImplementedException(const char* what);
	~NotImplementedException() throw () { }
};

//-----------------------------------------------------------------------------
struct NotSupportedException : Exception {
	NotSupportedException();
	NotSupportedException(const char* what);
	~NotSupportedException() throw () { }
};

#endif // __EXCEPTIONS_H__
